<template>
  <div class="record-stats-cards">
    <div class="stat-card">
      <div class="stat-header">
        <div class="stat-title">总病历数</div>
        <div class="stat-icon">
          <el-icon><Document /></el-icon>
        </div>
      </div>
      <div class="stat-value">{{ stats.total }}</div>
      <div class="stat-desc">全部病历记录</div>
    </div>

    <div class="stat-card">
      <div class="stat-header">
        <div class="stat-title">今日更新</div>
        <div class="stat-icon today-icon">
          <el-icon><Calendar /></el-icon>
        </div>
      </div>
      <div class="stat-value">{{ stats.today }}</div>
      <div class="stat-desc">今日新增/更新</div>
    </div>

    <div class="stat-card">
      <div class="stat-header">
        <div class="stat-title">待完善</div>
        <div class="stat-icon pending-icon">
          <el-icon><Clock /></el-icon>
        </div>
      </div>
      <div class="stat-value">{{ stats.pending }}</div>
      <div class="stat-desc">需要补充信息</div>
    </div>

    <div class="stat-card">
      <div class="stat-header">
        <div class="stat-title">已完成</div>
        <div class="stat-icon completed-icon">
          <el-icon><Checked /></el-icon>
        </div>
      </div>
      <div class="stat-value">{{ stats.completed }}</div>
      <div class="stat-desc">完整病历记录</div>
    </div>
  </div>
</template>

<script setup>
import { Document, Calendar, Clock, Checked } from '@element-plus/icons-vue'

defineProps({
  stats: {
    type: Object,
    required: true,
    default: () => ({
      total: 0,
      today: 0,
      pending: 0,
      completed: 0
    })
  }
})
</script>

<style lang="scss" scoped>
.record-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.stat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.stat-title {
  font-size: 16px;
  color: #606266;
}

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26, 117, 188, 0.1);
  color: #1a75bc;
  
  &.today-icon {
    background: rgba(103, 194, 58, 0.1);
    color: #67c23a;
  }
  
  &.pending-icon {
    background: rgba(230, 162, 60, 0.1);
    color: #e6a23c;
  }
  
  &.completed-icon {
    background: rgba(103, 194, 58, 0.1);
    color: #67c23a;
  }
}

.stat-value {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 4px;
}

.stat-desc {
  color: #909399;
  font-size: 14px;
}

// 响应式设计
@media (max-width: 992px) {
  .record-stats-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .record-stats-cards {
    grid-template-columns: 1fr;
  }
}
</style>